<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  x:Class="OpenLS.Spreadsheet.UI.ResizeAndRotateAdornerResources" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:omedia="http://schemas.Kherty.com/office/2007/media"
    >
    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0" x:Key="b1">
        <GradientStop Offset="0" Color="#FFBFD7B1" />
        <GradientStop Offset="0.13043478260869568" Color="#FFC4FF92" />
        <GradientStop Offset="0.33333333333333348" Color="#FFA7FF5C" />
        <GradientStop Offset="0.47826086956521729" Color="#FF94F046" />
        <GradientStop Offset="0.71014492753623193" Color="#FF96F248" />
        <GradientStop Offset="0.82608695652173891" Color="#FFACFF67" />
        <GradientStop Offset="1" Color="#FFD6FFB3" />
    </LinearGradientBrush>
    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0" x:Key="b2">
        <GradientStop Offset="0" Color="#FFF6FFFF" />
        <GradientStop Offset="0.18461538461538432" Color="#FFF0FFFF" />
        <GradientStop Offset="0.35384615384615381" Color="#FFE3F9FA" />
        <GradientStop Offset="0.53846153846153866" Color="#FFCAE9EC" />
        <GradientStop Offset="0.75384615384615372" Color="#FFE1FBFC" />
        <GradientStop Offset="0.92307692307692324" Color="#FFEFFFFF" />
        <GradientStop Offset="1" Color="#FFEFFFFF" />
    </LinearGradientBrush>
  <Style TargetType="{x:Type Thumb}" x:Key="thumbBase">
    <Setter Property ="Width" Value="10"/>
    <Setter Property ="Height" Value="10"/>
  </Style>
    <Style TargetType ="{x:Type Thumb}" x:Key="rotateThumb" BasedOn="{StaticResource thumbBase}">
      <Setter Property="Cursor" Value="{x:Static omedia:OfficeCursors.Rotate}"/>
      <Setter Property ="Template">
        <Setter.Value>
          <ControlTemplate TargetType ="{x:Type Thumb}">
            <Ellipse Width ="{TemplateBinding Width}" Height ="{TemplateBinding Height}" Fill="{StaticResource b1}" Stroke="#FF6D737B">

            </Ellipse>
            <ControlTemplate.Triggers>
              <Trigger Property="IsDragging" Value="True">
                <Setter Property="Cursor" Value="{x:Static omedia:OfficeCursors.Rotate4}"/>

              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
    <Style TargetType ="{x:Type Thumb}" x:Key="sideThumb" BasedOn="{StaticResource thumbBase}">
      <Setter Property ="Template">
        <Setter.Value>
          <ControlTemplate TargetType ="{x:Type Thumb}">
            <Rectangle Width ="{TemplateBinding Width}" Height ="{TemplateBinding Height}" Fill="{StaticResource b2}" Stroke="#FF6D737B">
            </Rectangle>
            <ControlTemplate.Triggers>
              <Trigger Property="IsDragging" Value="True">
                <Setter Property="Cursor" Value="{x:Static Cursors.Cross}"/>
              </Trigger>
              <Trigger Property="HorizontalAlignment" Value="Center">
                <Setter Property="Cursor" Value="{x:Static Cursors.SizeNS}"/>
              </Trigger>
              <Trigger Property="VerticalAlignment" Value="Center">
                <Setter Property="Cursor" Value="{x:Static Cursors.SizeWE}"/>
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>

      </Setter>
    </Style>
    <Style TargetType ="{x:Type Thumb}" x:Key="cornerThumb" BasedOn="{StaticResource thumbBase}">
      <Setter Property="Cursor" Value="SizeNWSE"/>
      <Setter Property ="Template">
        <Setter.Value>
          <ControlTemplate TargetType ="{x:Type Thumb}">
            <Ellipse Width ="{TemplateBinding Width}" Height ="{TemplateBinding Height}" 
                     Fill="{StaticResource b2}" Stroke="#FF6D737B" >
 
            </Ellipse>
            <ControlTemplate.Triggers>
              <Trigger Property="IsDragging" Value="True">
                <Setter Property="Cursor" Value="{x:Static Cursors.Cross}"/>
              </Trigger>
              <MultiTrigger>
                <MultiTrigger.Conditions>
                  <Condition Property="HorizontalAlignment" Value="Right"/>
                  <Condition Property="VerticalAlignment" Value="Top"/>
                </MultiTrigger.Conditions>
                <Setter Property ="Cursor" Value="SizeNESW"/>
              </MultiTrigger>
              <MultiTrigger>
                <MultiTrigger.Conditions>
                  <Condition Property="HorizontalAlignment" Value="Left"/>
                  <Condition Property="VerticalAlignment" Value="Bottom"/>
                </MultiTrigger.Conditions>
                <Setter Property ="Cursor" Value="SizeNESW"/>
              </MultiTrigger>
            </ControlTemplate.Triggers>

          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  <ControlTemplate TargetType="{x:Type ContentControl}" x:Key="resizeAndRotateControl">
    <Grid Margin="-5" Background="{x:Null}">
      <Line Stroke ="Black" StrokeThickness="1" Y2="-20" Name="rotateLine" HorizontalAlignment="Center" VerticalAlignment="Top"/>
      <Thumb Style="{StaticResource cornerThumb}" HorizontalAlignment ="Left" VerticalAlignment="Top"/>
      <Thumb Style="{StaticResource cornerThumb}" HorizontalAlignment ="Right" VerticalAlignment="Top"/>
      <Thumb Style="{StaticResource cornerThumb}" HorizontalAlignment ="Left" VerticalAlignment="Bottom"/>
      <Thumb Style="{StaticResource cornerThumb}" HorizontalAlignment ="Right" VerticalAlignment="Bottom"/>
      <Thumb Style="{StaticResource sideThumb}" HorizontalAlignment ="Center" VerticalAlignment="Top"/>
      <Thumb Style="{StaticResource sideThumb}" HorizontalAlignment ="Center" VerticalAlignment="Bottom"/>
      <Thumb Style="{StaticResource sideThumb}" HorizontalAlignment ="Left" VerticalAlignment="Center"/>
      <Thumb Style="{StaticResource sideThumb}" HorizontalAlignment ="Right" VerticalAlignment="Center"/>
      <Thumb Style="{StaticResource rotateThumb}" Name="rotateThumb" HorizontalAlignment ="Center" VerticalAlignment="Top" Margin="0 -20 0 0"/>
    </Grid>
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding AllowRotate}" Value="False">
                <Setter TargetName="rotateThumb" Property="Visibility" Value="Hidden" />
                <Setter TargetName="rotateLine" Property="Visibility" Value="Hidden" />
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

</ResourceDictionary>